
<!DOCTYPE html>

<html>
  
<!-- Mirrored from docs.sympy.org/latest/modules/simplify/fu.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 15 Jan 2022 03:28:17 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=utf-8" /><!-- /Added by HTTrack -->
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />

    <title>Hongguang Fu’s Trigonometric Simplification &#8212; SymPy 1.9 documentation</title>
    <link rel="stylesheet" type="text/css" href="../../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../../_static/default.css" />
    <link rel="stylesheet" type="text/css" href="../../_static/graphviz.css" />
    <link rel="stylesheet" type="text/css" href="../../_static/plot_directive.css" />
    <link rel="stylesheet" type="text/css" href="../../../../live.sympy.org/static/live-core.css" />
    <link rel="stylesheet" type="text/css" href="../../../../live.sympy.org/static/live-autocomplete.css" />
    <link rel="stylesheet" type="text/css" href="../../../../live.sympy.org/static/live-sphinx.css" />
    
    <script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
    <script src="../../_static/jquery.js"></script>
    <script src="../../_static/underscore.js"></script>
    <script src="../../_static/doctools.js"></script>
    <script src="../../../../live.sympy.org/static/utilities.js"></script>
    <script src="../../../../live.sympy.org/static/external/classy.js"></script>
    <script src="../../../../live.sympy.org/static/live-core.js"></script>
    <script src="../../../../live.sympy.org/static/live-autocomplete.js"></script>
    <script src="../../../../live.sympy.org/static/live-sphinx.js"></script>
    
    <link rel="shortcut icon" href="../../_static/sympy-notailtext-favicon.ico"/>
    <link href="fu.html" rel="canonical" />
    
    <link rel="index" title="Index" href="../../genindex.html" />
    <link rel="search" title="Search" href="../../search.html" />
    <link rel="next" title="Solvers" href="../solvers/solvers.html" />
    <link rel="prev" title="Hypergeometric Expansion" href="hyperexpand.html" /> 
  </head><body>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="../solvers/solvers.html" title="Solvers"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="hyperexpand.html" title="Hypergeometric Expansion"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../index.html">SymPy 1.9 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../index.html" >SymPy Modules Reference</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="index.html" accesskey="U">Simplify</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="#">Hongguang Fu’s Trigonometric Simplification</a></li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <section id="hongguang-fu-s-trigonometric-simplification">
<h1>Hongguang Fu’s Trigonometric Simplification<a class="headerlink" href="#hongguang-fu-s-trigonometric-simplification" title="Permalink to this headline">¶</a></h1>
<p>Implementation of the trigsimp algorithm by Fu et al.</p>
<p>The idea behind the Fu algorithm is to use a sequence of rules
that students learn during their pre-calculus courses.
The rules are applied heuristically and it uses a greedy algorithm to
apply multiple rules simultaneously and choose the result with the least
leaf counts.</p>
<p>There are transform rules in which a single rule is applied to the
expression tree. The following are just mnemonic in nature; see the
docstrings for examples.</p>
<ul class="simple">
<li><p><a class="reference internal" href="#sympy.simplify.fu.TR0" title="sympy.simplify.fu.TR0"><code class="xref py py-func docutils literal notranslate"><span class="pre">TR0()</span></code></a> - simplify expression</p></li>
<li><p><a class="reference internal" href="#sympy.simplify.fu.TR1" title="sympy.simplify.fu.TR1"><code class="xref py py-func docutils literal notranslate"><span class="pre">TR1()</span></code></a> - sec-csc to cos-sin</p></li>
<li><p><a class="reference internal" href="#sympy.simplify.fu.TR2" title="sympy.simplify.fu.TR2"><code class="xref py py-func docutils literal notranslate"><span class="pre">TR2()</span></code></a> - tan-cot to sin-cos ratio</p></li>
<li><p><a class="reference internal" href="#sympy.simplify.fu.TR2i" title="sympy.simplify.fu.TR2i"><code class="xref py py-func docutils literal notranslate"><span class="pre">TR2i()</span></code></a> - sin-cos ratio to tan</p></li>
<li><p><a class="reference internal" href="#sympy.simplify.fu.TR3" title="sympy.simplify.fu.TR3"><code class="xref py py-func docutils literal notranslate"><span class="pre">TR3()</span></code></a> - angle canonicalization</p></li>
<li><p><a class="reference internal" href="#sympy.simplify.fu.TR4" title="sympy.simplify.fu.TR4"><code class="xref py py-func docutils literal notranslate"><span class="pre">TR4()</span></code></a> - functions at special angles</p></li>
<li><p><a class="reference internal" href="#sympy.simplify.fu.TR5" title="sympy.simplify.fu.TR5"><code class="xref py py-func docutils literal notranslate"><span class="pre">TR5()</span></code></a> - powers of sin to powers of cos</p></li>
<li><p><a class="reference internal" href="#sympy.simplify.fu.TR6" title="sympy.simplify.fu.TR6"><code class="xref py py-func docutils literal notranslate"><span class="pre">TR6()</span></code></a> - powers of cos to powers of sin</p></li>
<li><p><a class="reference internal" href="#sympy.simplify.fu.TR7" title="sympy.simplify.fu.TR7"><code class="xref py py-func docutils literal notranslate"><span class="pre">TR7()</span></code></a> - reduce cos power (increase angle)</p></li>
<li><p><a class="reference internal" href="#sympy.simplify.fu.TR8" title="sympy.simplify.fu.TR8"><code class="xref py py-func docutils literal notranslate"><span class="pre">TR8()</span></code></a> - expand products of sin-cos to sums</p></li>
<li><p><a class="reference internal" href="#sympy.simplify.fu.TR9" title="sympy.simplify.fu.TR9"><code class="xref py py-func docutils literal notranslate"><span class="pre">TR9()</span></code></a> - contract sums of sin-cos to products</p></li>
<li><p><a class="reference internal" href="#sympy.simplify.fu.TR10" title="sympy.simplify.fu.TR10"><code class="xref py py-func docutils literal notranslate"><span class="pre">TR10()</span></code></a> - separate sin-cos arguments</p></li>
<li><p><a class="reference internal" href="#sympy.simplify.fu.TR10i" title="sympy.simplify.fu.TR10i"><code class="xref py py-func docutils literal notranslate"><span class="pre">TR10i()</span></code></a> - collect sin-cos arguments</p></li>
<li><p><a class="reference internal" href="#sympy.simplify.fu.TR11" title="sympy.simplify.fu.TR11"><code class="xref py py-func docutils literal notranslate"><span class="pre">TR11()</span></code></a> - reduce double angles</p></li>
<li><p><a class="reference internal" href="#sympy.simplify.fu.TR12" title="sympy.simplify.fu.TR12"><code class="xref py py-func docutils literal notranslate"><span class="pre">TR12()</span></code></a> - separate tan arguments</p></li>
<li><p><a class="reference internal" href="#sympy.simplify.fu.TR12i" title="sympy.simplify.fu.TR12i"><code class="xref py py-func docutils literal notranslate"><span class="pre">TR12i()</span></code></a> - collect tan arguments</p></li>
<li><p><a class="reference internal" href="#sympy.simplify.fu.TR13" title="sympy.simplify.fu.TR13"><code class="xref py py-func docutils literal notranslate"><span class="pre">TR13()</span></code></a> - expand product of tan-cot</p></li>
<li><p><a class="reference internal" href="#sympy.simplify.fu.TRmorrie" title="sympy.simplify.fu.TRmorrie"><code class="xref py py-func docutils literal notranslate"><span class="pre">TRmorrie()</span></code></a> - prod(cos(x*2**i), (i, 0, k - 1)) -&gt; sin(2**k*x)/(2**k*sin(x))</p></li>
<li><p><a class="reference internal" href="#sympy.simplify.fu.TR14" title="sympy.simplify.fu.TR14"><code class="xref py py-func docutils literal notranslate"><span class="pre">TR14()</span></code></a> - factored powers of sin or cos to cos or sin power</p></li>
<li><p><a class="reference internal" href="#sympy.simplify.fu.TR15" title="sympy.simplify.fu.TR15"><code class="xref py py-func docutils literal notranslate"><span class="pre">TR15()</span></code></a> - negative powers of sin to cot power</p></li>
<li><p><a class="reference internal" href="#sympy.simplify.fu.TR16" title="sympy.simplify.fu.TR16"><code class="xref py py-func docutils literal notranslate"><span class="pre">TR16()</span></code></a> - negative powers of cos to tan power</p></li>
<li><p><a class="reference internal" href="#sympy.simplify.fu.TR22" title="sympy.simplify.fu.TR22"><code class="xref py py-func docutils literal notranslate"><span class="pre">TR22()</span></code></a> - tan-cot powers to negative powers of sec-csc functions</p></li>
<li><p><a class="reference internal" href="#sympy.simplify.fu.TR111" title="sympy.simplify.fu.TR111"><code class="xref py py-func docutils literal notranslate"><span class="pre">TR111()</span></code></a> - negative sin-cos-tan powers to csc-sec-cot</p></li>
</ul>
<p>There are 4 combination transforms (CTR1 - CTR4) in which a sequence of
transformations are applied and the simplest expression is selected from
a few options.</p>
<p>Finally, there are the 2 rule lists (RL1 and RL2), which apply a
sequence of transformations and combined transformations, and the <code class="docutils literal notranslate"><span class="pre">fu</span></code>
algorithm itself, which applies rules and rule lists and selects the
best expressions. There is also a function <code class="docutils literal notranslate"><span class="pre">L</span></code> which counts the number
of trigonometric functions that appear in the expression.</p>
<p>Other than TR0, re-writing of expressions is not done by the transformations.
e.g. TR10i finds pairs of terms in a sum that are in the form like
<code class="docutils literal notranslate"><span class="pre">cos(x)*cos(y)</span> <span class="pre">+</span> <span class="pre">sin(x)*sin(y)</span></code>. Such expression are targeted in a bottom-up
traversal of the expression, but no manipulation to make them appear is
attempted. For example,</p>
<p>Set-up for examples below:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.simplify.fu</span> <span class="kn">import</span> <span class="n">fu</span><span class="p">,</span> <span class="n">L</span><span class="p">,</span> <span class="n">TR9</span><span class="p">,</span> <span class="n">TR10i</span><span class="p">,</span> <span class="n">TR11</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">factor</span><span class="p">,</span> <span class="n">sin</span><span class="p">,</span> <span class="n">cos</span><span class="p">,</span> <span class="n">powsimp</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">z</span><span class="p">,</span> <span class="n">a</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">time</span> <span class="kn">import</span> <span class="n">time</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">eq</span> <span class="o">=</span> <span class="n">cos</span><span class="p">(</span><span class="n">x</span> <span class="o">+</span> <span class="n">y</span><span class="p">)</span><span class="o">/</span><span class="n">cos</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR10i</span><span class="p">(</span><span class="n">eq</span><span class="o">.</span><span class="n">expand</span><span class="p">(</span><span class="n">trig</span><span class="o">=</span><span class="kc">True</span><span class="p">))</span>
<span class="go">-sin(x)*sin(y)/cos(x) + cos(y)</span>
</pre></div>
</div>
<p>If the expression is put in “normal” form (with a common denominator) then
the transformation is successful:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">TR10i</span><span class="p">(</span><span class="n">_</span><span class="o">.</span><span class="n">normal</span><span class="p">())</span>
<span class="go">cos(x + y)/cos(x)</span>
</pre></div>
</div>
<p>TR11’s behavior is similar. It rewrites double angles as smaller angles but
doesn’t do any simplification of the result.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">TR11</span><span class="p">(</span><span class="n">sin</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">**</span><span class="n">a</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="o">**</span><span class="p">(</span><span class="o">-</span><span class="n">a</span><span class="p">),</span> <span class="mi">1</span><span class="p">)</span>
<span class="go">(2*sin(1)*cos(1))**a/cos(1)**a</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">powsimp</span><span class="p">(</span><span class="n">_</span><span class="p">)</span>
<span class="go">(2*sin(1))**a</span>
</pre></div>
</div>
<p>The temptation is to try make these TR rules “smarter” but that should really
be done at a higher level; the TR rules should try maintain the “do one thing
well” principle.  There is one exception, however. In TR10i and TR9 terms are
recognized even when they are each multiplied by a common factor:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">fu</span><span class="p">(</span><span class="n">a</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="n">y</span><span class="p">)</span> <span class="o">+</span> <span class="n">a</span><span class="o">*</span><span class="n">sin</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">*</span><span class="n">sin</span><span class="p">(</span><span class="n">y</span><span class="p">))</span>
<span class="go">a*cos(x - y)</span>
</pre></div>
</div>
<p>Factoring with <code class="docutils literal notranslate"><span class="pre">factor_terms</span></code> is used but it is “JIT”-like, being delayed
until it is deemed necessary. Furthermore, if the factoring does not
help with the simplification, it is not retained, so
<code class="docutils literal notranslate"><span class="pre">a*cos(x)*cos(y)</span> <span class="pre">+</span> <span class="pre">a*sin(x)*sin(z)</span></code> does not become a factored
(but unsimplified in the trigonometric sense) expression:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">fu</span><span class="p">(</span><span class="n">a</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="n">y</span><span class="p">)</span> <span class="o">+</span> <span class="n">a</span><span class="o">*</span><span class="n">sin</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">*</span><span class="n">sin</span><span class="p">(</span><span class="n">z</span><span class="p">))</span>
<span class="go">a*sin(x)*sin(z) + a*cos(x)*cos(y)</span>
</pre></div>
</div>
<p>In some cases factoring might be a good idea, but the user is left
to make that decision. For example:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">expr</span><span class="o">=</span><span class="p">((</span><span class="mi">15</span><span class="o">*</span><span class="n">sin</span><span class="p">(</span><span class="mi">2</span><span class="o">*</span><span class="n">x</span><span class="p">)</span> <span class="o">+</span> <span class="mi">19</span><span class="o">*</span><span class="n">sin</span><span class="p">(</span><span class="n">x</span> <span class="o">+</span> <span class="n">y</span><span class="p">)</span> <span class="o">+</span> <span class="mi">17</span><span class="o">*</span><span class="n">sin</span><span class="p">(</span><span class="n">x</span> <span class="o">+</span> <span class="n">z</span><span class="p">)</span> <span class="o">+</span> <span class="mi">19</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="n">x</span> <span class="o">-</span> <span class="n">z</span><span class="p">)</span> <span class="o">+</span>
<span class="gp">... </span><span class="mi">25</span><span class="p">)</span><span class="o">*</span><span class="p">(</span><span class="mi">20</span><span class="o">*</span><span class="n">sin</span><span class="p">(</span><span class="mi">2</span><span class="o">*</span><span class="n">x</span><span class="p">)</span> <span class="o">+</span> <span class="mi">15</span><span class="o">*</span><span class="n">sin</span><span class="p">(</span><span class="n">x</span> <span class="o">+</span> <span class="n">y</span><span class="p">)</span> <span class="o">+</span> <span class="n">sin</span><span class="p">(</span><span class="n">y</span> <span class="o">+</span> <span class="n">z</span><span class="p">)</span> <span class="o">+</span> <span class="mi">14</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="n">x</span> <span class="o">-</span> <span class="n">z</span><span class="p">)</span> <span class="o">+</span>
<span class="gp">... </span><span class="mi">14</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="n">y</span> <span class="o">-</span> <span class="n">z</span><span class="p">))</span><span class="o">*</span><span class="p">(</span><span class="mi">9</span><span class="o">*</span><span class="n">sin</span><span class="p">(</span><span class="mi">2</span><span class="o">*</span><span class="n">y</span><span class="p">)</span> <span class="o">+</span> <span class="mi">12</span><span class="o">*</span><span class="n">sin</span><span class="p">(</span><span class="n">y</span> <span class="o">+</span> <span class="n">z</span><span class="p">)</span> <span class="o">+</span> <span class="mi">10</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="n">x</span> <span class="o">-</span> <span class="n">y</span><span class="p">)</span> <span class="o">+</span> <span class="mi">2</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="n">y</span> <span class="o">-</span>
<span class="gp">... </span><span class="n">z</span><span class="p">)</span> <span class="o">+</span> <span class="mi">18</span><span class="p">))</span><span class="o">.</span><span class="n">expand</span><span class="p">(</span><span class="n">trig</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="o">.</span><span class="n">expand</span><span class="p">()</span>
</pre></div>
</div>
<p>In the expanded state, there are nearly 1000 trig functions:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">L</span><span class="p">(</span><span class="n">expr</span><span class="p">)</span>
<span class="go">932</span>
</pre></div>
</div>
<p>If the expression where factored first, this would take time but the
resulting expression would be transformed very quickly:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="k">def</span> <span class="nf">clock</span><span class="p">(</span><span class="n">f</span><span class="p">,</span> <span class="n">n</span><span class="o">=</span><span class="mi">2</span><span class="p">):</span>
<span class="gp">... </span>   <span class="n">t</span><span class="o">=</span><span class="n">time</span><span class="p">();</span> <span class="n">f</span><span class="p">();</span> <span class="k">return</span> <span class="nb">round</span><span class="p">(</span><span class="n">time</span><span class="p">()</span><span class="o">-</span><span class="n">t</span><span class="p">,</span> <span class="n">n</span><span class="p">)</span>
<span class="gp">...</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">clock</span><span class="p">(</span><span class="k">lambda</span><span class="p">:</span> <span class="n">factor</span><span class="p">(</span><span class="n">expr</span><span class="p">))</span>  
<span class="go">0.86</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">clock</span><span class="p">(</span><span class="k">lambda</span><span class="p">:</span> <span class="n">TR10i</span><span class="p">(</span><span class="n">expr</span><span class="p">),</span> <span class="mi">3</span><span class="p">)</span>  
<span class="go">0.016</span>
</pre></div>
</div>
<p>If the unexpanded expression is used, the transformation takes longer but
not as long as it took to factor it and then transform it:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">clock</span><span class="p">(</span><span class="k">lambda</span><span class="p">:</span> <span class="n">TR10i</span><span class="p">(</span><span class="n">expr</span><span class="p">),</span> <span class="mi">2</span><span class="p">)</span>  
<span class="go">0.28</span>
</pre></div>
</div>
<p>So neither expansion nor factoring is used in <code class="docutils literal notranslate"><span class="pre">TR10i</span></code>: if the
expression is already factored (or partially factored) then expansion
with <code class="docutils literal notranslate"><span class="pre">trig=True</span></code> would destroy what is already known and take
longer; if the expression is expanded, factoring may take longer than
simply applying the transformation itself.</p>
<p>Although the algorithms should be canonical, always giving the same
result, they may not yield the best result. This, in general, is
the nature of simplification where searching all possible transformation
paths is very expensive. Here is a simple example. There are 6 terms
in the following sum:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">expr</span> <span class="o">=</span> <span class="p">(</span><span class="n">sin</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">**</span><span class="mi">2</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="n">y</span><span class="p">)</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="n">z</span><span class="p">)</span> <span class="o">+</span> <span class="n">sin</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">*</span><span class="n">sin</span><span class="p">(</span><span class="n">y</span><span class="p">)</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="n">z</span><span class="p">)</span> <span class="o">+</span>
<span class="gp">... </span><span class="n">sin</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">*</span><span class="n">sin</span><span class="p">(</span><span class="n">z</span><span class="p">)</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="n">y</span><span class="p">)</span> <span class="o">+</span> <span class="n">sin</span><span class="p">(</span><span class="n">y</span><span class="p">)</span><span class="o">*</span><span class="n">sin</span><span class="p">(</span><span class="n">z</span><span class="p">)</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">**</span><span class="mi">2</span> <span class="o">+</span> <span class="n">sin</span><span class="p">(</span><span class="n">y</span><span class="p">)</span><span class="o">*</span><span class="n">sin</span><span class="p">(</span><span class="n">z</span><span class="p">)</span> <span class="o">+</span>
<span class="gp">... </span><span class="n">cos</span><span class="p">(</span><span class="n">y</span><span class="p">)</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="n">z</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">args</span> <span class="o">=</span> <span class="n">expr</span><span class="o">.</span><span class="n">args</span>
</pre></div>
</div>
<p>Serendipitously, fu gives the best result:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">fu</span><span class="p">(</span><span class="n">expr</span><span class="p">)</span>
<span class="go">3*cos(y - z)/2 - cos(2*x + y + z)/2</span>
</pre></div>
</div>
<p>But if different terms were combined, a less-optimal result might be
obtained, requiring some additional work to get better simplification,
but still less than optimal. The following shows an alternative form
of <code class="docutils literal notranslate"><span class="pre">expr</span></code> that resists optimal simplification once a given step
is taken since it leads to a dead end:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">TR9</span><span class="p">(</span><span class="o">-</span><span class="n">cos</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">**</span><span class="mi">2</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="n">y</span> <span class="o">+</span> <span class="n">z</span><span class="p">)</span> <span class="o">+</span> <span class="mi">3</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="n">y</span> <span class="o">-</span> <span class="n">z</span><span class="p">)</span><span class="o">/</span><span class="mi">2</span> <span class="o">+</span>
<span class="gp">... </span>    <span class="n">cos</span><span class="p">(</span><span class="n">y</span> <span class="o">+</span> <span class="n">z</span><span class="p">)</span><span class="o">/</span><span class="mi">2</span> <span class="o">+</span> <span class="n">cos</span><span class="p">(</span><span class="o">-</span><span class="mi">2</span><span class="o">*</span><span class="n">x</span> <span class="o">+</span> <span class="n">y</span> <span class="o">+</span> <span class="n">z</span><span class="p">)</span><span class="o">/</span><span class="mi">4</span> <span class="o">-</span> <span class="n">cos</span><span class="p">(</span><span class="mi">2</span><span class="o">*</span><span class="n">x</span> <span class="o">+</span> <span class="n">y</span> <span class="o">+</span> <span class="n">z</span><span class="p">)</span><span class="o">/</span><span class="mi">4</span><span class="p">)</span>
<span class="go">sin(2*x)*sin(y + z)/2 - cos(x)**2*cos(y + z) + 3*cos(y - z)/2 + cos(y + z)/2</span>
</pre></div>
</div>
<p>Here is a smaller expression that exhibits the same behavior:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">sin</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">*</span><span class="n">sin</span><span class="p">(</span><span class="n">z</span><span class="p">)</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="n">y</span><span class="p">)</span> <span class="o">+</span> <span class="n">sin</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">*</span><span class="n">sin</span><span class="p">(</span><span class="n">y</span><span class="p">)</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="n">z</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR10i</span><span class="p">(</span><span class="n">a</span><span class="p">)</span>
<span class="go">sin(x)*sin(y + z)*cos(x)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">newa</span> <span class="o">=</span> <span class="n">_</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR10i</span><span class="p">(</span><span class="n">expr</span> <span class="o">-</span> <span class="n">a</span><span class="p">)</span>  <span class="c1"># this combines two more of the remaining terms</span>
<span class="go">sin(x)**2*cos(y)*cos(z) + sin(y)*sin(z)*cos(x)**2 + cos(y - z)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR10i</span><span class="p">(</span><span class="n">_</span> <span class="o">+</span> <span class="n">newa</span><span class="p">)</span> <span class="o">==</span> <span class="n">_</span> <span class="o">+</span> <span class="n">newa</span>  <span class="c1"># but now there is no more simplification</span>
<span class="go">True</span>
</pre></div>
</div>
<p>Without getting lucky or trying all possible pairings of arguments, the
final result may be less than optimal and impossible to find without
better heuristics or brute force trial of all possibilities.</p>
<section id="rules">
<h2>Rules<a class="headerlink" href="#rules" title="Permalink to this headline">¶</a></h2>
<dl class="py function">
<dt class="sig sig-object py" id="sympy.simplify.fu.TR0">
<span class="sig-prename descclassname"><span class="pre">sympy.simplify.fu.</span></span><span class="sig-name descname"><span class="pre">TR0</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rv</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/simplify/fu.py#L31-L37"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.simplify.fu.TR0" title="Permalink to this definition">¶</a></dt>
<dd><p>Simplification of rational polynomials, trying to simplify
the expression, e.g. combine things like 3*x + 2*x, etc….</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.simplify.fu.TR1">
<span class="sig-prename descclassname"><span class="pre">sympy.simplify.fu.</span></span><span class="sig-name descname"><span class="pre">TR1</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rv</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/simplify/fu.py#L40-L61"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.simplify.fu.TR1" title="Permalink to this definition">¶</a></dt>
<dd><p>Replace sec, csc with 1/cos, 1/sin</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.simplify.fu</span> <span class="kn">import</span> <span class="n">TR1</span><span class="p">,</span> <span class="n">sec</span><span class="p">,</span> <span class="n">csc</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR1</span><span class="p">(</span><span class="mi">2</span><span class="o">*</span><span class="n">csc</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="o">+</span> <span class="n">sec</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>
<span class="go">1/cos(x) + 2/sin(x)</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.simplify.fu.TR2">
<span class="sig-prename descclassname"><span class="pre">sympy.simplify.fu.</span></span><span class="sig-name descname"><span class="pre">TR2</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rv</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/simplify/fu.py#L64-L91"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.simplify.fu.TR2" title="Permalink to this definition">¶</a></dt>
<dd><p>Replace tan and cot with sin/cos and cos/sin</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.simplify.fu</span> <span class="kn">import</span> <span class="n">TR2</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">tan</span><span class="p">,</span> <span class="n">cot</span><span class="p">,</span> <span class="n">sin</span><span class="p">,</span> <span class="n">cos</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR2</span><span class="p">(</span><span class="n">tan</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>
<span class="go">sin(x)/cos(x)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR2</span><span class="p">(</span><span class="n">cot</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>
<span class="go">cos(x)/sin(x)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR2</span><span class="p">(</span><span class="n">tan</span><span class="p">(</span><span class="n">tan</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="o">-</span> <span class="n">sin</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">/</span><span class="n">cos</span><span class="p">(</span><span class="n">x</span><span class="p">)))</span>
<span class="go">0</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.simplify.fu.TR2i">
<span class="sig-prename descclassname"><span class="pre">sympy.simplify.fu.</span></span><span class="sig-name descname"><span class="pre">TR2i</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rv</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">half</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/simplify/fu.py#L94-L207"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.simplify.fu.TR2i" title="Permalink to this definition">¶</a></dt>
<dd><dl class="simple">
<dt>Converts ratios involving sin and cos as follows::</dt><dd><p>sin(x)/cos(x) -&gt; tan(x)
sin(x)/(cos(x) + 1) -&gt; tan(x/2) if half=True</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.simplify.fu</span> <span class="kn">import</span> <span class="n">TR2i</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span><span class="p">,</span> <span class="n">a</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">sin</span><span class="p">,</span> <span class="n">cos</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR2i</span><span class="p">(</span><span class="n">sin</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">/</span><span class="n">cos</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>
<span class="go">tan(x)</span>
</pre></div>
</div>
<p>Powers of the numerator and denominator are also recognized</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">TR2i</span><span class="p">(</span><span class="n">sin</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">**</span><span class="mi">2</span><span class="o">/</span><span class="p">(</span><span class="n">cos</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)</span><span class="o">**</span><span class="mi">2</span><span class="p">,</span> <span class="n">half</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="go">tan(x/2)**2</span>
</pre></div>
</div>
<p>The transformation does not take place unless assumptions allow
(i.e. the base must be positive or the exponent must be an integer
for both numerator and denominator)</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">TR2i</span><span class="p">(</span><span class="n">sin</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">**</span><span class="n">a</span><span class="o">/</span><span class="p">(</span><span class="n">cos</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)</span><span class="o">**</span><span class="n">a</span><span class="p">)</span>
<span class="go">sin(x)**a/(cos(x) + 1)**a</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.simplify.fu.TR3">
<span class="sig-prename descclassname"><span class="pre">sympy.simplify.fu.</span></span><span class="sig-name descname"><span class="pre">TR3</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rv</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/simplify/fu.py#L210-L249"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.simplify.fu.TR3" title="Permalink to this definition">¶</a></dt>
<dd><p>Induced formula: example sin(-a) = -sin(a)</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.simplify.fu</span> <span class="kn">import</span> <span class="n">TR3</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">pi</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">cos</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR3</span><span class="p">(</span><span class="n">cos</span><span class="p">(</span><span class="n">y</span> <span class="o">-</span> <span class="n">x</span><span class="o">*</span><span class="p">(</span><span class="n">y</span> <span class="o">-</span> <span class="n">x</span><span class="p">)))</span>
<span class="go">cos(x*(x - y) + y)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">cos</span><span class="p">(</span><span class="n">pi</span><span class="o">/</span><span class="mi">2</span> <span class="o">+</span> <span class="n">x</span><span class="p">)</span>
<span class="go">-sin(x)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">cos</span><span class="p">(</span><span class="mi">30</span><span class="o">*</span><span class="n">pi</span><span class="o">/</span><span class="mi">2</span> <span class="o">+</span> <span class="n">x</span><span class="p">)</span>
<span class="go">-cos(x)</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.simplify.fu.TR4">
<span class="sig-prename descclassname"><span class="pre">sympy.simplify.fu.</span></span><span class="sig-name descname"><span class="pre">TR4</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rv</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/simplify/fu.py#L252-L276"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.simplify.fu.TR4" title="Permalink to this definition">¶</a></dt>
<dd><p>Identify values of special angles.</p>
<p class="rubric">A=  0   Pi/6        Pi/4        Pi/3        Pi/2</p>
<p>sin(a)  0   1/2         sqrt(2)/2   sqrt(3)/2   1
cos(a)  1   sqrt(3)/2   sqrt(2)/2   1/2         0
tan(a)  0   sqt(3)/3    1           sqrt(3)     –</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">pi</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">cos</span><span class="p">,</span> <span class="n">sin</span><span class="p">,</span> <span class="n">tan</span><span class="p">,</span> <span class="n">cot</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">for</span> <span class="n">s</span> <span class="ow">in</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">pi</span><span class="o">/</span><span class="mi">6</span><span class="p">,</span> <span class="n">pi</span><span class="o">/</span><span class="mi">4</span><span class="p">,</span> <span class="n">pi</span><span class="o">/</span><span class="mi">3</span><span class="p">,</span> <span class="n">pi</span><span class="o">/</span><span class="mi">2</span><span class="p">):</span>
<span class="gp">... </span>   <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;</span><span class="si">%s</span><span class="s1"> </span><span class="si">%s</span><span class="s1"> </span><span class="si">%s</span><span class="s1"> </span><span class="si">%s</span><span class="s1">&#39;</span> <span class="o">%</span> <span class="p">(</span><span class="n">cos</span><span class="p">(</span><span class="n">s</span><span class="p">),</span> <span class="n">sin</span><span class="p">(</span><span class="n">s</span><span class="p">),</span> <span class="n">tan</span><span class="p">(</span><span class="n">s</span><span class="p">),</span> <span class="n">cot</span><span class="p">(</span><span class="n">s</span><span class="p">)))</span>
<span class="gp">...</span>
<span class="go">1 0 0 zoo</span>
<span class="go">sqrt(3)/2 1/2 sqrt(3)/3 sqrt(3)</span>
<span class="go">sqrt(2)/2 sqrt(2)/2 1 1</span>
<span class="go">1/2 sqrt(3)/2 sqrt(3) sqrt(3)/3</span>
<span class="go">0 1 zoo 0</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.simplify.fu.TR5">
<span class="sig-prename descclassname"><span class="pre">sympy.simplify.fu.</span></span><span class="sig-name descname"><span class="pre">TR5</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rv</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">max</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">4</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pow</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/simplify/fu.py#L343-L361"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.simplify.fu.TR5" title="Permalink to this definition">¶</a></dt>
<dd><p>Replacement of sin**2 with 1 - cos(x)**2.</p>
<p>See _TR56 docstring for advanced use of <code class="docutils literal notranslate"><span class="pre">max</span></code> and <code class="docutils literal notranslate"><span class="pre">pow</span></code>.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.simplify.fu</span> <span class="kn">import</span> <span class="n">TR5</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">sin</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR5</span><span class="p">(</span><span class="n">sin</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">**</span><span class="mi">2</span><span class="p">)</span>
<span class="go">1 - cos(x)**2</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR5</span><span class="p">(</span><span class="n">sin</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">**-</span><span class="mi">2</span><span class="p">)</span>  <span class="c1"># unchanged</span>
<span class="go">sin(x)**(-2)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR5</span><span class="p">(</span><span class="n">sin</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">**</span><span class="mi">4</span><span class="p">)</span>
<span class="go">(1 - cos(x)**2)**2</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.simplify.fu.TR6">
<span class="sig-prename descclassname"><span class="pre">sympy.simplify.fu.</span></span><span class="sig-name descname"><span class="pre">TR6</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rv</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">max</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">4</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pow</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/simplify/fu.py#L364-L382"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.simplify.fu.TR6" title="Permalink to this definition">¶</a></dt>
<dd><p>Replacement of cos**2 with 1 - sin(x)**2.</p>
<p>See _TR56 docstring for advanced use of <code class="docutils literal notranslate"><span class="pre">max</span></code> and <code class="docutils literal notranslate"><span class="pre">pow</span></code>.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.simplify.fu</span> <span class="kn">import</span> <span class="n">TR6</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">cos</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR6</span><span class="p">(</span><span class="n">cos</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">**</span><span class="mi">2</span><span class="p">)</span>
<span class="go">1 - sin(x)**2</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR6</span><span class="p">(</span><span class="n">cos</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">**-</span><span class="mi">2</span><span class="p">)</span>  <span class="c1">#unchanged</span>
<span class="go">cos(x)**(-2)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR6</span><span class="p">(</span><span class="n">cos</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">**</span><span class="mi">4</span><span class="p">)</span>
<span class="go">(1 - sin(x)**2)**2</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.simplify.fu.TR7">
<span class="sig-prename descclassname"><span class="pre">sympy.simplify.fu.</span></span><span class="sig-name descname"><span class="pre">TR7</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rv</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/simplify/fu.py#L385-L406"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.simplify.fu.TR7" title="Permalink to this definition">¶</a></dt>
<dd><p>Lowering the degree of cos(x)**2.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.simplify.fu</span> <span class="kn">import</span> <span class="n">TR7</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">cos</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR7</span><span class="p">(</span><span class="n">cos</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">**</span><span class="mi">2</span><span class="p">)</span>
<span class="go">cos(2*x)/2 + 1/2</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR7</span><span class="p">(</span><span class="n">cos</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">**</span><span class="mi">2</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)</span>
<span class="go">cos(2*x)/2 + 3/2</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.simplify.fu.TR8">
<span class="sig-prename descclassname"><span class="pre">sympy.simplify.fu.</span></span><span class="sig-name descname"><span class="pre">TR8</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rv</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">first</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/simplify/fu.py#L409-L481"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.simplify.fu.TR8" title="Permalink to this definition">¶</a></dt>
<dd><p>Converting products of <code class="docutils literal notranslate"><span class="pre">cos</span></code> and/or <code class="docutils literal notranslate"><span class="pre">sin</span></code> to a sum or
difference of <code class="docutils literal notranslate"><span class="pre">cos</span></code> and or <code class="docutils literal notranslate"><span class="pre">sin</span></code> terms.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.simplify.fu</span> <span class="kn">import</span> <span class="n">TR8</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">cos</span><span class="p">,</span> <span class="n">sin</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR8</span><span class="p">(</span><span class="n">cos</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="mi">3</span><span class="p">))</span>
<span class="go">cos(5)/2 + cos(1)/2</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR8</span><span class="p">(</span><span class="n">cos</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">*</span><span class="n">sin</span><span class="p">(</span><span class="mi">3</span><span class="p">))</span>
<span class="go">sin(5)/2 + sin(1)/2</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR8</span><span class="p">(</span><span class="n">sin</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">*</span><span class="n">sin</span><span class="p">(</span><span class="mi">3</span><span class="p">))</span>
<span class="go">-cos(5)/2 + cos(1)/2</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.simplify.fu.TR9">
<span class="sig-prename descclassname"><span class="pre">sympy.simplify.fu.</span></span><span class="sig-name descname"><span class="pre">TR9</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rv</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/simplify/fu.py#L484-L575"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.simplify.fu.TR9" title="Permalink to this definition">¶</a></dt>
<dd><p>Sum of <code class="docutils literal notranslate"><span class="pre">cos</span></code> or <code class="docutils literal notranslate"><span class="pre">sin</span></code> terms as a product of <code class="docutils literal notranslate"><span class="pre">cos</span></code> or <code class="docutils literal notranslate"><span class="pre">sin</span></code>.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.simplify.fu</span> <span class="kn">import</span> <span class="n">TR9</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">cos</span><span class="p">,</span> <span class="n">sin</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR9</span><span class="p">(</span><span class="n">cos</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> <span class="o">+</span> <span class="n">cos</span><span class="p">(</span><span class="mi">2</span><span class="p">))</span>
<span class="go">2*cos(1/2)*cos(3/2)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR9</span><span class="p">(</span><span class="n">cos</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> <span class="o">+</span> <span class="mi">2</span><span class="o">*</span><span class="n">sin</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> <span class="o">+</span> <span class="mi">2</span><span class="o">*</span><span class="n">sin</span><span class="p">(</span><span class="mi">2</span><span class="p">))</span>
<span class="go">cos(1) + 4*sin(3/2)*cos(1/2)</span>
</pre></div>
</div>
<p>If no change is made by TR9, no re-arrangement of the
expression will be made. For example, though factoring
of common term is attempted, if the factored expression
wasn’t changed, the original expression will be returned:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">TR9</span><span class="p">(</span><span class="n">cos</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span> <span class="o">+</span> <span class="n">cos</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="mi">2</span><span class="p">))</span>
<span class="go">cos(3) + cos(2)*cos(3)</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.simplify.fu.TR10">
<span class="sig-prename descclassname"><span class="pre">sympy.simplify.fu.</span></span><span class="sig-name descname"><span class="pre">TR10</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rv</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">first</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/simplify/fu.py#L578-L623"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.simplify.fu.TR10" title="Permalink to this definition">¶</a></dt>
<dd><p>Separate sums in <code class="docutils literal notranslate"><span class="pre">cos</span></code> and <code class="docutils literal notranslate"><span class="pre">sin</span></code>.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.simplify.fu</span> <span class="kn">import</span> <span class="n">TR10</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">,</span> <span class="n">c</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">cos</span><span class="p">,</span> <span class="n">sin</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR10</span><span class="p">(</span><span class="n">cos</span><span class="p">(</span><span class="n">a</span> <span class="o">+</span> <span class="n">b</span><span class="p">))</span>
<span class="go">-sin(a)*sin(b) + cos(a)*cos(b)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR10</span><span class="p">(</span><span class="n">sin</span><span class="p">(</span><span class="n">a</span> <span class="o">+</span> <span class="n">b</span><span class="p">))</span>
<span class="go">sin(a)*cos(b) + sin(b)*cos(a)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR10</span><span class="p">(</span><span class="n">sin</span><span class="p">(</span><span class="n">a</span> <span class="o">+</span> <span class="n">b</span> <span class="o">+</span> <span class="n">c</span><span class="p">))</span>
<span class="go">(-sin(a)*sin(b) + cos(a)*cos(b))*sin(c) +     (sin(a)*cos(b) + sin(b)*cos(a))*cos(c)</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.simplify.fu.TR10i">
<span class="sig-prename descclassname"><span class="pre">sympy.simplify.fu.</span></span><span class="sig-name descname"><span class="pre">TR10i</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rv</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/simplify/fu.py#L626-L755"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.simplify.fu.TR10i" title="Permalink to this definition">¶</a></dt>
<dd><p>Sum of products to function of sum.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.simplify.fu</span> <span class="kn">import</span> <span class="n">TR10i</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">cos</span><span class="p">,</span> <span class="n">sin</span><span class="p">,</span> <span class="n">sqrt</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">TR10i</span><span class="p">(</span><span class="n">cos</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span> <span class="o">+</span> <span class="n">sin</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="o">*</span><span class="n">sin</span><span class="p">(</span><span class="mi">3</span><span class="p">))</span>
<span class="go">cos(2)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR10i</span><span class="p">(</span><span class="n">cos</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="o">*</span><span class="n">sin</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span> <span class="o">+</span> <span class="n">sin</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span> <span class="o">+</span> <span class="n">cos</span><span class="p">(</span><span class="mi">3</span><span class="p">))</span>
<span class="go">cos(3) + sin(4)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR10i</span><span class="p">(</span><span class="n">sqrt</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">*</span><span class="n">x</span> <span class="o">+</span> <span class="n">sqrt</span><span class="p">(</span><span class="mi">6</span><span class="p">)</span><span class="o">*</span><span class="n">sin</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">*</span><span class="n">x</span><span class="p">)</span>
<span class="go">2*sqrt(2)*x*sin(x + pi/6)</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.simplify.fu.TR11">
<span class="sig-prename descclassname"><span class="pre">sympy.simplify.fu.</span></span><span class="sig-name descname"><span class="pre">TR11</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rv</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">base</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/simplify/fu.py#L758-L835"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.simplify.fu.TR11" title="Permalink to this definition">¶</a></dt>
<dd><p>Function of double angle to product. The <code class="docutils literal notranslate"><span class="pre">base</span></code> argument can be used
to indicate what is the un-doubled argument, e.g. if 3*pi/7 is the base
then cosine and sine functions with argument 6*pi/7 will be replaced.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.simplify.fu</span> <span class="kn">import</span> <span class="n">TR11</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">cos</span><span class="p">,</span> <span class="n">sin</span><span class="p">,</span> <span class="n">pi</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR11</span><span class="p">(</span><span class="n">sin</span><span class="p">(</span><span class="mi">2</span><span class="o">*</span><span class="n">x</span><span class="p">))</span>
<span class="go">2*sin(x)*cos(x)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR11</span><span class="p">(</span><span class="n">cos</span><span class="p">(</span><span class="mi">2</span><span class="o">*</span><span class="n">x</span><span class="p">))</span>
<span class="go">-sin(x)**2 + cos(x)**2</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR11</span><span class="p">(</span><span class="n">sin</span><span class="p">(</span><span class="mi">4</span><span class="o">*</span><span class="n">x</span><span class="p">))</span>
<span class="go">4*(-sin(x)**2 + cos(x)**2)*sin(x)*cos(x)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR11</span><span class="p">(</span><span class="n">sin</span><span class="p">(</span><span class="mi">4</span><span class="o">*</span><span class="n">x</span><span class="o">/</span><span class="mi">3</span><span class="p">))</span>
<span class="go">4*(-sin(x/3)**2 + cos(x/3)**2)*sin(x/3)*cos(x/3)</span>
</pre></div>
</div>
<p>If the arguments are simply integers, no change is made
unless a base is provided:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">TR11</span><span class="p">(</span><span class="n">cos</span><span class="p">(</span><span class="mi">2</span><span class="p">))</span>
<span class="go">cos(2)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR11</span><span class="p">(</span><span class="n">cos</span><span class="p">(</span><span class="mi">4</span><span class="p">),</span> <span class="mi">2</span><span class="p">)</span>
<span class="go">-sin(2)**2 + cos(2)**2</span>
</pre></div>
</div>
<p>There is a subtle issue here in that autosimplification will convert
some higher angles to lower angles</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">cos</span><span class="p">(</span><span class="mi">6</span><span class="o">*</span><span class="n">pi</span><span class="o">/</span><span class="mi">7</span><span class="p">)</span> <span class="o">+</span> <span class="n">cos</span><span class="p">(</span><span class="mi">3</span><span class="o">*</span><span class="n">pi</span><span class="o">/</span><span class="mi">7</span><span class="p">)</span>
<span class="go">-cos(pi/7) + cos(3*pi/7)</span>
</pre></div>
</div>
<p>The 6*pi/7 angle is now pi/7 but can be targeted with TR11 by supplying
the 3*pi/7 base:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">TR11</span><span class="p">(</span><span class="n">_</span><span class="p">,</span> <span class="mi">3</span><span class="o">*</span><span class="n">pi</span><span class="o">/</span><span class="mi">7</span><span class="p">)</span>
<span class="go">-sin(3*pi/7)**2 + cos(3*pi/7)**2 + cos(3*pi/7)</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.simplify.fu.TR12">
<span class="sig-prename descclassname"><span class="pre">sympy.simplify.fu.</span></span><span class="sig-name descname"><span class="pre">TR12</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rv</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">first</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/simplify/fu.py#L899-L931"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.simplify.fu.TR12" title="Permalink to this definition">¶</a></dt>
<dd><p>Separate sums in <code class="docutils literal notranslate"><span class="pre">tan</span></code>.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">tan</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.simplify.fu</span> <span class="kn">import</span> <span class="n">TR12</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR12</span><span class="p">(</span><span class="n">tan</span><span class="p">(</span><span class="n">x</span> <span class="o">+</span> <span class="n">y</span><span class="p">))</span>
<span class="go">(tan(x) + tan(y))/(-tan(x)*tan(y) + 1)</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.simplify.fu.TR12i">
<span class="sig-prename descclassname"><span class="pre">sympy.simplify.fu.</span></span><span class="sig-name descname"><span class="pre">TR12i</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rv</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/simplify/fu.py#L934-L1056"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.simplify.fu.TR12i" title="Permalink to this definition">¶</a></dt>
<dd><p>Combine tan arguments as
(tan(y) + tan(x))/(tan(x)*tan(y) - 1) -&gt; -tan(x + y).</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.simplify.fu</span> <span class="kn">import</span> <span class="n">TR12i</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">tan</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">,</span> <span class="n">c</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">ta</span><span class="p">,</span> <span class="n">tb</span><span class="p">,</span> <span class="n">tc</span> <span class="o">=</span> <span class="p">[</span><span class="n">tan</span><span class="p">(</span><span class="n">i</span><span class="p">)</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">,</span> <span class="n">c</span><span class="p">)]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR12i</span><span class="p">((</span><span class="n">ta</span> <span class="o">+</span> <span class="n">tb</span><span class="p">)</span><span class="o">/</span><span class="p">(</span><span class="o">-</span><span class="n">ta</span><span class="o">*</span><span class="n">tb</span> <span class="o">+</span> <span class="mi">1</span><span class="p">))</span>
<span class="go">tan(a + b)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR12i</span><span class="p">((</span><span class="n">ta</span> <span class="o">+</span> <span class="n">tb</span><span class="p">)</span><span class="o">/</span><span class="p">(</span><span class="n">ta</span><span class="o">*</span><span class="n">tb</span> <span class="o">-</span> <span class="mi">1</span><span class="p">))</span>
<span class="go">-tan(a + b)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR12i</span><span class="p">((</span><span class="o">-</span><span class="n">ta</span> <span class="o">-</span> <span class="n">tb</span><span class="p">)</span><span class="o">/</span><span class="p">(</span><span class="n">ta</span><span class="o">*</span><span class="n">tb</span> <span class="o">-</span> <span class="mi">1</span><span class="p">))</span>
<span class="go">tan(a + b)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">eq</span> <span class="o">=</span> <span class="p">(</span><span class="n">ta</span> <span class="o">+</span> <span class="n">tb</span><span class="p">)</span><span class="o">/</span><span class="p">(</span><span class="o">-</span><span class="n">ta</span><span class="o">*</span><span class="n">tb</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)</span><span class="o">**</span><span class="mi">2</span><span class="o">*</span><span class="p">(</span><span class="o">-</span><span class="mi">3</span><span class="o">*</span><span class="n">ta</span> <span class="o">-</span> <span class="mi">3</span><span class="o">*</span><span class="n">tc</span><span class="p">)</span><span class="o">/</span><span class="p">(</span><span class="mi">2</span><span class="o">*</span><span class="p">(</span><span class="n">ta</span><span class="o">*</span><span class="n">tc</span> <span class="o">-</span> <span class="mi">1</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR12i</span><span class="p">(</span><span class="n">eq</span><span class="o">.</span><span class="n">expand</span><span class="p">())</span>
<span class="go">-3*tan(a + b)*tan(a + c)/(2*(tan(a) + tan(b) - 1))</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.simplify.fu.TR13">
<span class="sig-prename descclassname"><span class="pre">sympy.simplify.fu.</span></span><span class="sig-name descname"><span class="pre">TR13</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rv</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/simplify/fu.py#L1059-L1103"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.simplify.fu.TR13" title="Permalink to this definition">¶</a></dt>
<dd><p>Change products of <code class="docutils literal notranslate"><span class="pre">tan</span></code> or <code class="docutils literal notranslate"><span class="pre">cot</span></code>.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.simplify.fu</span> <span class="kn">import</span> <span class="n">TR13</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">tan</span><span class="p">,</span> <span class="n">cot</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR13</span><span class="p">(</span><span class="n">tan</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span><span class="o">*</span><span class="n">tan</span><span class="p">(</span><span class="mi">2</span><span class="p">))</span>
<span class="go">-tan(2)/tan(5) - tan(3)/tan(5) + 1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR13</span><span class="p">(</span><span class="n">cot</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span><span class="o">*</span><span class="n">cot</span><span class="p">(</span><span class="mi">2</span><span class="p">))</span>
<span class="go">cot(2)*cot(5) + 1 + cot(3)*cot(5)</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.simplify.fu.TRmorrie">
<span class="sig-prename descclassname"><span class="pre">sympy.simplify.fu.</span></span><span class="sig-name descname"><span class="pre">TRmorrie</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rv</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/simplify/fu.py#L1106-L1222"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.simplify.fu.TRmorrie" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns cos(x)*cos(2*x)*…*cos(2**(k-1)*x) -&gt; sin(2**k*x)/(2**k*sin(x))</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.simplify.fu</span> <span class="kn">import</span> <span class="n">TRmorrie</span><span class="p">,</span> <span class="n">TR8</span><span class="p">,</span> <span class="n">TR3</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Mul</span><span class="p">,</span> <span class="n">cos</span><span class="p">,</span> <span class="n">pi</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TRmorrie</span><span class="p">(</span><span class="n">cos</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="mi">2</span><span class="o">*</span><span class="n">x</span><span class="p">))</span>
<span class="go">sin(4*x)/(4*sin(x))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TRmorrie</span><span class="p">(</span><span class="mi">7</span><span class="o">*</span><span class="n">Mul</span><span class="p">(</span><span class="o">*</span><span class="p">[</span><span class="n">cos</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">10</span><span class="p">)]))</span>
<span class="go">7*sin(12)*sin(16)*cos(5)*cos(7)*cos(9)/(64*sin(1)*sin(3))</span>
</pre></div>
</div>
<p>Sometimes autosimplification will cause a power to be
not recognized. e.g. in the following, cos(4*pi/7) automatically
simplifies to -cos(3*pi/7) so only 2 of the 3 terms are
recognized:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">TRmorrie</span><span class="p">(</span><span class="n">cos</span><span class="p">(</span><span class="n">pi</span><span class="o">/</span><span class="mi">7</span><span class="p">)</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="mi">2</span><span class="o">*</span><span class="n">pi</span><span class="o">/</span><span class="mi">7</span><span class="p">)</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="mi">4</span><span class="o">*</span><span class="n">pi</span><span class="o">/</span><span class="mi">7</span><span class="p">))</span>
<span class="go">-sin(3*pi/7)*cos(3*pi/7)/(4*sin(pi/7))</span>
</pre></div>
</div>
<p>A touch by TR8 resolves the expression to a Rational</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">TR8</span><span class="p">(</span><span class="n">_</span><span class="p">)</span>
<span class="go">-1/8</span>
</pre></div>
</div>
<p>In this case, if eq is unsimplified, the answer is obtained
directly:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">eq</span> <span class="o">=</span> <span class="n">cos</span><span class="p">(</span><span class="n">pi</span><span class="o">/</span><span class="mi">9</span><span class="p">)</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="mi">2</span><span class="o">*</span><span class="n">pi</span><span class="o">/</span><span class="mi">9</span><span class="p">)</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="mi">3</span><span class="o">*</span><span class="n">pi</span><span class="o">/</span><span class="mi">9</span><span class="p">)</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="mi">4</span><span class="o">*</span><span class="n">pi</span><span class="o">/</span><span class="mi">9</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TRmorrie</span><span class="p">(</span><span class="n">eq</span><span class="p">)</span>
<span class="go">1/16</span>
</pre></div>
</div>
<p>But if angles are made canonical with TR3 then the answer
is not simplified without further work:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">TR3</span><span class="p">(</span><span class="n">eq</span><span class="p">)</span>
<span class="go">sin(pi/18)*cos(pi/9)*cos(2*pi/9)/2</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TRmorrie</span><span class="p">(</span><span class="n">_</span><span class="p">)</span>
<span class="go">sin(pi/18)*sin(4*pi/9)/(8*sin(pi/9))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR8</span><span class="p">(</span><span class="n">_</span><span class="p">)</span>
<span class="go">cos(7*pi/18)/(16*sin(pi/9))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR3</span><span class="p">(</span><span class="n">_</span><span class="p">)</span>
<span class="go">1/16</span>
</pre></div>
</div>
<p>The original expression would have resolve to 1/16 directly with TR8,
however:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">TR8</span><span class="p">(</span><span class="n">eq</span><span class="p">)</span>
<span class="go">1/16</span>
</pre></div>
</div>
<p class="rubric">References</p>
<dl class="citation">
<dt class="label" id="r703"><span class="brackets"><a class="fn-backref" href="#id1">R703</a></span></dt>
<dd><p><a class="reference external" href="https://en.wikipedia.org/wiki/Morrie%27s_law">https://en.wikipedia.org/wiki/Morrie%27s_law</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.simplify.fu.TR14">
<span class="sig-prename descclassname"><span class="pre">sympy.simplify.fu.</span></span><span class="sig-name descname"><span class="pre">TR14</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rv</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">first</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/simplify/fu.py#L1225-L1343"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.simplify.fu.TR14" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert factored powers of sin and cos identities into simpler
expressions.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.simplify.fu</span> <span class="kn">import</span> <span class="n">TR14</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">cos</span><span class="p">,</span> <span class="n">sin</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR14</span><span class="p">((</span><span class="n">cos</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span><span class="o">*</span><span class="p">(</span><span class="n">cos</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="o">+</span> <span class="mi">1</span><span class="p">))</span>
<span class="go">-sin(x)**2</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR14</span><span class="p">((</span><span class="n">sin</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span><span class="o">*</span><span class="p">(</span><span class="n">sin</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="o">+</span> <span class="mi">1</span><span class="p">))</span>
<span class="go">-cos(x)**2</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p1</span> <span class="o">=</span> <span class="p">(</span><span class="n">cos</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)</span><span class="o">*</span><span class="p">(</span><span class="n">cos</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p2</span> <span class="o">=</span> <span class="p">(</span><span class="n">cos</span><span class="p">(</span><span class="n">y</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span><span class="o">*</span><span class="mi">2</span><span class="o">*</span><span class="p">(</span><span class="n">cos</span><span class="p">(</span><span class="n">y</span><span class="p">)</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p3</span> <span class="o">=</span> <span class="p">(</span><span class="mi">3</span><span class="o">*</span><span class="p">(</span><span class="n">cos</span><span class="p">(</span><span class="n">y</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">))</span><span class="o">*</span><span class="p">(</span><span class="mi">3</span><span class="o">*</span><span class="p">(</span><span class="n">cos</span><span class="p">(</span><span class="n">y</span><span class="p">)</span> <span class="o">+</span> <span class="mi">1</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR14</span><span class="p">(</span><span class="n">p1</span><span class="o">*</span><span class="n">p2</span><span class="o">*</span><span class="n">p3</span><span class="o">*</span><span class="p">(</span><span class="n">x</span> <span class="o">-</span> <span class="mi">1</span><span class="p">))</span>
<span class="go">-18*(x - 1)*sin(x)**2*sin(y)**4</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.simplify.fu.TR15">
<span class="sig-prename descclassname"><span class="pre">sympy.simplify.fu.</span></span><span class="sig-name descname"><span class="pre">TR15</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rv</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">max</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">4</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pow</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/simplify/fu.py#L1346-L1376"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.simplify.fu.TR15" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert sin(x)**-2 to 1 + cot(x)**2.</p>
<p>See _TR56 docstring for advanced use of <code class="docutils literal notranslate"><span class="pre">max</span></code> and <code class="docutils literal notranslate"><span class="pre">pow</span></code>.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.simplify.fu</span> <span class="kn">import</span> <span class="n">TR15</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">sin</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR15</span><span class="p">(</span><span class="mi">1</span> <span class="o">-</span> <span class="mi">1</span><span class="o">/</span><span class="n">sin</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">**</span><span class="mi">2</span><span class="p">)</span>
<span class="go">-cot(x)**2</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.simplify.fu.TR16">
<span class="sig-prename descclassname"><span class="pre">sympy.simplify.fu.</span></span><span class="sig-name descname"><span class="pre">TR16</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rv</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">max</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">4</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pow</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/simplify/fu.py#L1379-L1409"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.simplify.fu.TR16" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert cos(x)**-2 to 1 + tan(x)**2.</p>
<p>See _TR56 docstring for advanced use of <code class="docutils literal notranslate"><span class="pre">max</span></code> and <code class="docutils literal notranslate"><span class="pre">pow</span></code>.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.simplify.fu</span> <span class="kn">import</span> <span class="n">TR16</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">cos</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR16</span><span class="p">(</span><span class="mi">1</span> <span class="o">-</span> <span class="mi">1</span><span class="o">/</span><span class="n">cos</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">**</span><span class="mi">2</span><span class="p">)</span>
<span class="go">-tan(x)**2</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.simplify.fu.TR111">
<span class="sig-prename descclassname"><span class="pre">sympy.simplify.fu.</span></span><span class="sig-name descname"><span class="pre">TR111</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rv</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/simplify/fu.py#L1412-L1441"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.simplify.fu.TR111" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert f(x)**-i to g(x)**i where either <code class="docutils literal notranslate"><span class="pre">i</span></code> is an integer
or the base is positive and f, g are: tan, cot; sin, csc; or cos, sec.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.simplify.fu</span> <span class="kn">import</span> <span class="n">TR111</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">tan</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR111</span><span class="p">(</span><span class="mi">1</span> <span class="o">-</span> <span class="mi">1</span><span class="o">/</span><span class="n">tan</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">**</span><span class="mi">2</span><span class="p">)</span>
<span class="go">1 - cot(x)**2</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.simplify.fu.TR22">
<span class="sig-prename descclassname"><span class="pre">sympy.simplify.fu.</span></span><span class="sig-name descname"><span class="pre">TR22</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rv</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">max</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">4</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pow</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/simplify/fu.py#L1444-L1470"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.simplify.fu.TR22" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert tan(x)**2 to sec(x)**2 - 1 and cot(x)**2 to csc(x)**2 - 1.</p>
<p>See _TR56 docstring for advanced use of <code class="docutils literal notranslate"><span class="pre">max</span></code> and <code class="docutils literal notranslate"><span class="pre">pow</span></code>.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.simplify.fu</span> <span class="kn">import</span> <span class="n">TR22</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">tan</span><span class="p">,</span> <span class="n">cot</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR22</span><span class="p">(</span><span class="mi">1</span> <span class="o">+</span> <span class="n">tan</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">**</span><span class="mi">2</span><span class="p">)</span>
<span class="go">sec(x)**2</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TR22</span><span class="p">(</span><span class="mi">1</span> <span class="o">+</span> <span class="n">cot</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">**</span><span class="mi">2</span><span class="p">)</span>
<span class="go">csc(x)**2</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.simplify.fu.TRpower">
<span class="sig-prename descclassname"><span class="pre">sympy.simplify.fu.</span></span><span class="sig-name descname"><span class="pre">TRpower</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rv</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/simplify/fu.py#L1473-L1516"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.simplify.fu.TRpower" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert sin(x)**n and cos(x)**n with positive n to sums.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.simplify.fu</span> <span class="kn">import</span> <span class="n">TRpower</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">cos</span><span class="p">,</span> <span class="n">sin</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TRpower</span><span class="p">(</span><span class="n">sin</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">**</span><span class="mi">6</span><span class="p">)</span>
<span class="go">-15*cos(2*x)/32 + 3*cos(4*x)/16 - cos(6*x)/32 + 5/16</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TRpower</span><span class="p">(</span><span class="n">sin</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">**</span><span class="mi">3</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="mi">2</span><span class="o">*</span><span class="n">x</span><span class="p">)</span><span class="o">**</span><span class="mi">4</span><span class="p">)</span>
<span class="go">(3*sin(x)/4 - sin(3*x)/4)*(cos(4*x)/2 + cos(8*x)/8 + 3/8)</span>
</pre></div>
</div>
<p class="rubric">References</p>
<dl class="citation">
<dt class="label" id="r704"><span class="brackets"><a class="fn-backref" href="#id2">R704</a></span></dt>
<dd><p><a class="reference external" href="https://en.wikipedia.org/wiki/List_of_trigonometric_identities#Power-reduction_formulae">https://en.wikipedia.org/wiki/List_of_trigonometric_identities#Power-reduction_formulae</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.simplify.fu.fu">
<span class="sig-prename descclassname"><span class="pre">sympy.simplify.fu.</span></span><span class="sig-name descname"><span class="pre">fu</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">rv</span></em>, <em class="sig-param"><span class="pre">measure=&lt;function</span> <span class="pre">&lt;lambda&gt;&gt;</span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/simplify/fu.py#L1571-L1659"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.simplify.fu.fu" title="Permalink to this definition">¶</a></dt>
<dd><p>Attempt to simplify expression by using transformation rules given
in the algorithm by Fu et al.</p>
<p><a class="reference internal" href="#sympy.simplify.fu.fu" title="sympy.simplify.fu.fu"><code class="xref py py-func docutils literal notranslate"><span class="pre">fu()</span></code></a> will try to minimize the objective function <code class="docutils literal notranslate"><span class="pre">measure</span></code>.
By default this first minimizes the number of trig terms and then minimizes
the number of total operations.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.simplify.fu</span> <span class="kn">import</span> <span class="n">fu</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">cos</span><span class="p">,</span> <span class="n">sin</span><span class="p">,</span> <span class="n">tan</span><span class="p">,</span> <span class="n">pi</span><span class="p">,</span> <span class="n">S</span><span class="p">,</span> <span class="n">sqrt</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">fu</span><span class="p">(</span><span class="n">sin</span><span class="p">(</span><span class="mi">50</span><span class="p">)</span><span class="o">**</span><span class="mi">2</span> <span class="o">+</span> <span class="n">cos</span><span class="p">(</span><span class="mi">50</span><span class="p">)</span><span class="o">**</span><span class="mi">2</span> <span class="o">+</span> <span class="n">sin</span><span class="p">(</span><span class="n">pi</span><span class="o">/</span><span class="mi">6</span><span class="p">))</span>
<span class="go">3/2</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">fu</span><span class="p">(</span><span class="n">sqrt</span><span class="p">(</span><span class="mi">6</span><span class="p">)</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="o">+</span> <span class="n">sqrt</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">*</span><span class="n">sin</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>
<span class="go">2*sqrt(2)*sin(x + pi/3)</span>
</pre></div>
</div>
<p>CTR1 example</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">eq</span> <span class="o">=</span> <span class="n">sin</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">**</span><span class="mi">4</span> <span class="o">-</span> <span class="n">cos</span><span class="p">(</span><span class="n">y</span><span class="p">)</span><span class="o">**</span><span class="mi">2</span> <span class="o">+</span> <span class="n">sin</span><span class="p">(</span><span class="n">y</span><span class="p">)</span><span class="o">**</span><span class="mi">2</span> <span class="o">+</span> <span class="mi">2</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">**</span><span class="mi">2</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">fu</span><span class="p">(</span><span class="n">eq</span><span class="p">)</span>
<span class="go">cos(x)**4 - 2*cos(y)**2 + 2</span>
</pre></div>
</div>
<p>CTR2 example</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">fu</span><span class="p">(</span><span class="n">S</span><span class="o">.</span><span class="n">Half</span> <span class="o">-</span> <span class="n">cos</span><span class="p">(</span><span class="mi">2</span><span class="o">*</span><span class="n">x</span><span class="p">)</span><span class="o">/</span><span class="mi">2</span><span class="p">)</span>
<span class="go">sin(x)**2</span>
</pre></div>
</div>
<p>CTR3 example</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">fu</span><span class="p">(</span><span class="n">sin</span><span class="p">(</span><span class="n">a</span><span class="p">)</span><span class="o">*</span><span class="p">(</span><span class="n">cos</span><span class="p">(</span><span class="n">b</span><span class="p">)</span> <span class="o">-</span> <span class="n">sin</span><span class="p">(</span><span class="n">b</span><span class="p">))</span> <span class="o">+</span> <span class="n">cos</span><span class="p">(</span><span class="n">a</span><span class="p">)</span><span class="o">*</span><span class="p">(</span><span class="n">sin</span><span class="p">(</span><span class="n">b</span><span class="p">)</span> <span class="o">+</span> <span class="n">cos</span><span class="p">(</span><span class="n">b</span><span class="p">)))</span>
<span class="go">sqrt(2)*sin(a + b + pi/4)</span>
</pre></div>
</div>
<p>CTR4 example</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">fu</span><span class="p">(</span><span class="n">sqrt</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">/</span><span class="mi">2</span> <span class="o">+</span> <span class="n">sin</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">/</span><span class="mi">2</span><span class="p">)</span>
<span class="go">sin(x + pi/3)</span>
</pre></div>
</div>
<p>Example 1</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">fu</span><span class="p">(</span><span class="mi">1</span><span class="o">-</span><span class="n">sin</span><span class="p">(</span><span class="mi">2</span><span class="o">*</span><span class="n">x</span><span class="p">)</span><span class="o">**</span><span class="mi">2</span><span class="o">/</span><span class="mi">4</span><span class="o">-</span><span class="n">sin</span><span class="p">(</span><span class="n">y</span><span class="p">)</span><span class="o">**</span><span class="mi">2</span><span class="o">-</span><span class="n">cos</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">**</span><span class="mi">4</span><span class="p">)</span>
<span class="go">-cos(x)**2 + cos(y)**2</span>
</pre></div>
</div>
<p>Example 2</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">fu</span><span class="p">(</span><span class="n">cos</span><span class="p">(</span><span class="mi">4</span><span class="o">*</span><span class="n">pi</span><span class="o">/</span><span class="mi">9</span><span class="p">))</span>
<span class="go">sin(pi/18)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">fu</span><span class="p">(</span><span class="n">cos</span><span class="p">(</span><span class="n">pi</span><span class="o">/</span><span class="mi">9</span><span class="p">)</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="mi">2</span><span class="o">*</span><span class="n">pi</span><span class="o">/</span><span class="mi">9</span><span class="p">)</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="mi">3</span><span class="o">*</span><span class="n">pi</span><span class="o">/</span><span class="mi">9</span><span class="p">)</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="mi">4</span><span class="o">*</span><span class="n">pi</span><span class="o">/</span><span class="mi">9</span><span class="p">))</span>
<span class="go">1/16</span>
</pre></div>
</div>
<p>Example 3</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">fu</span><span class="p">(</span><span class="n">tan</span><span class="p">(</span><span class="mi">7</span><span class="o">*</span><span class="n">pi</span><span class="o">/</span><span class="mi">18</span><span class="p">)</span><span class="o">+</span><span class="n">tan</span><span class="p">(</span><span class="mi">5</span><span class="o">*</span><span class="n">pi</span><span class="o">/</span><span class="mi">18</span><span class="p">)</span><span class="o">-</span><span class="n">sqrt</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span><span class="o">*</span><span class="n">tan</span><span class="p">(</span><span class="mi">5</span><span class="o">*</span><span class="n">pi</span><span class="o">/</span><span class="mi">18</span><span class="p">)</span><span class="o">*</span><span class="n">tan</span><span class="p">(</span><span class="mi">7</span><span class="o">*</span><span class="n">pi</span><span class="o">/</span><span class="mi">18</span><span class="p">))</span>
<span class="go">-sqrt(3)</span>
</pre></div>
</div>
<p>Objective function example</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">fu</span><span class="p">(</span><span class="n">sin</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">/</span><span class="n">cos</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>  <span class="c1"># default objective function</span>
<span class="go">tan(x)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">fu</span><span class="p">(</span><span class="n">sin</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">/</span><span class="n">cos</span><span class="p">(</span><span class="n">x</span><span class="p">),</span> <span class="n">measure</span><span class="o">=</span><span class="k">lambda</span> <span class="n">x</span><span class="p">:</span> <span class="o">-</span><span class="n">x</span><span class="o">.</span><span class="n">count_ops</span><span class="p">())</span> <span class="c1"># maximize op count</span>
<span class="go">sin(x)/cos(x)</span>
</pre></div>
</div>
<p class="rubric">References</p>
<dl class="citation">
<dt class="label" id="r705"><span class="brackets"><a class="fn-backref" href="#id3">R705</a></span></dt>
<dd><p><a class="reference external" href="https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.657.2478&amp;rep=rep1&amp;type=pdf">https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.657.2478&amp;rep=rep1&amp;type=pdf</a></p>
</dd>
</dl>
</dd></dl>

</section>
<section id="notes">
<h2>Notes<a class="headerlink" href="#notes" title="Permalink to this headline">¶</a></h2>
<p>This work was started by Dimitar Vlahovski at the Technological School
“Electronic systems” (30.11.2011).</p>
<p>Beyond TR13, other rules are not from the original paper, but extended
in SymPy.</p>
</section>
<section id="references">
<h2>References<a class="headerlink" href="#references" title="Permalink to this headline">¶</a></h2>
<dl class="footnote brackets">
<dt class="label" id="id4"><span class="brackets">1</span></dt>
<dd><p>Fu, Hongguang, Xiuqin Zhong, and Zhenbing Zeng.
“Automated and readable simplification of trigonometric expressions.”
Mathematical and computer modelling 44.11 (2006): 1169-1177.
<a class="reference external" href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.657.2478&amp;rep=rep1&amp;type=pdf">http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.657.2478&amp;rep=rep1&amp;type=pdf</a></p>
</dd>
<dt class="label" id="id5"><span class="brackets">2</span></dt>
<dd><p>A formula sheet for trigonometric functions.
<a class="reference external" href="http://www.sosmath.com/trig/Trig5/trig5/pdf/pdf.html">http://www.sosmath.com/trig/Trig5/trig5/pdf/pdf.html</a></p>
</dd>
</dl>
</section>
</section>


            <div class="clearer"></div>
          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="../../index.html">
              <img class="logo" src="../../_static/sympylogo.png" alt="Logo"/>
            </a></p>
  <h3><a href="../../index.html">Table of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Hongguang Fu’s Trigonometric Simplification</a><ul>
<li><a class="reference internal" href="#rules">Rules</a></li>
<li><a class="reference internal" href="#notes">Notes</a></li>
<li><a class="reference internal" href="#references">References</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="hyperexpand.html"
                        title="previous chapter">Hypergeometric Expansion</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="../solvers/solvers.html"
                        title="next chapter">Solvers</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="../../_sources/modules/simplify/fu.rst.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="https://docs.sympy.org/latest/search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script>$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="../solvers/solvers.html" title="Solvers"
             >next</a> |</li>
        <li class="right" >
          <a href="hyperexpand.html" title="Hypergeometric Expansion"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../index.html">SymPy 1.9 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../index.html" >SymPy Modules Reference</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="index.html" >Simplify</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="#">Hongguang Fu’s Trigonometric Simplification</a></li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2021 SymPy Development Team.
      Last updated on Sep 30, 2021.
      Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 4.1.2.
    </div>
  </body>

<!-- Mirrored from docs.sympy.org/latest/modules/simplify/fu.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 15 Jan 2022 03:28:18 GMT -->
</html>